<extend name="Layout:ly1"/>

<block name="head">
    <script type="text/javascript">
        $(function () {
            $(".btn-primary").click(function () {
                var name = $("input[name='name']").val();
                var softversion = $("input[name='softversion']").val();
                var softintro = $("textarea[name='softintro']").val();
                var addtime = $("input[name='addtime']").val();
                var url = $("input[name='url']").val();
                $.get("{:U('Admin/Upgrade/updateVersion')}", {
                    'action': 'edit',
                    'name': name,
                    'softversion': softversion,
                    'softintro': softintro,
                    'addtime': addtime,
                    'url': url,
                    'type': 2
                }, function (msg) {
//                    if (msg == 200) {
//                        layer.msg("更新成功，3秒后自动关闭~~", {ico: 1, time: 3000}, function () {
//                            window.location.reload();    //刷新父页面
//                        })
//                    } else {
//                        layer.msg("更新失败，3秒后自动关闭~~", {ico: 1, time: 3000}, function () {
//                            window.location.reload();    //刷新父页面
//                        })
//                    }
                })
            })
        })
    </script>
</block>

<block name="body">
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">软件版本 (Android)</h1>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-info">
                    <div class="panel-heading">
                        请填写以下表单并确认
                    </div>
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <form id="form_user_setting" class="form-horizontal" method="post" action="">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">软件名称</label>
                                <div class="col-sm-4">
                                    <input type="text" name="name" class="form-control" value="{$data[0]['name']}"
                                           placeholder="例：农医问药">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">软件版本</label>
                                <div class="col-sm-4">
                                    <input type="text" name="softversion" class="form-control"
                                           value="{$data[0]['version']}" placeholder="例：01.00.00010">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">软件介绍</label>
                                <div class="col-sm-4">
                                    <textarea class="form-control" name="softintro" id="" cols="10" rows="6">{$data[0]['intro']}</textarea>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">更新地址</label>
                                <div class="col-sm-4">
                                    <input type="text" name="url" class="form-control" value="{$data[0]['url']}">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-2 control-label">更新时间</label>
                                <div class="col-sm-4">
                                    <input type="text" name="addtime" class="form-control"
                                           value="{$data[0]['addtime']|date=" Y-m-d H:i:s",###}"
                                    placeholder="例：2016-01-01">
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <button type="submit" id="button_user_setting_submit" class="btn btn-primary"
                                            style="padding:6px 25px;">升级版本
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                    <!-- /.panel-body -->
                </div>
            </div>
        </div>
    </div>
</block>